
#ifndef H_C_TYPES_H
#define H_C_TYPES_H

#include <stdarg.h>

#ifdef  DLL_EXPORT
#ifdef  STLCDLL_EXPORTS
#undef  STLCDLL_EXPORTS
#define STLCDLL_EXPORTS __declspec(dllexport)
#else
#undef  STLCDLL_EXPORTS
#define STLCDLL_EXPORTS __declspec(dllimport)
#endif
#else
#define STLCDLL_EXPORTS
#endif

#ifdef __cplusplus
extern "C" {
#endif



#define false      0
#define true       1

#ifndef NULL
#define NULL ((void*)0)
#endif


#ifndef bool
#define bool  unsigned int    
#define true  1   
#define false 0   
#endif

#ifndef size_t
#define size_t unsigned int   
#endif

#define StlcAlloc malloc
#define StlcFree   free

#define TYPE_NAME_SIZE               32 

#define STLCT_SIGNED_CHAR              "signed char"
#define STLCT_UNSIGNED_CHAR            "unsigned char"
#define STLCT_SIGNED_SHORT             "signed short"
#define STLCT_UNSIGNED_SHORT           "unsigned short"
#define STLCT_SIGNED_INT               "signed int"
#define STLCT_UNSIGNED_INT             "unsigned int"
#define STLCT_SIGNED_LONG              "signed long"
#define STLCT_UNSIGNED_LONG            "unsigned long"
#define STLCT_FLOAT                    "float"
#define STLCT_DOUBLE                   "double"
#define STLCT_STRING                   "string"
#define STLCT_WSTRING                  "wstring"

#define STLCT_PAIR                     "pair"
#define STLCT_VECTOR                   "vector"
#define STLCT_LIST                     "list"
#define STLCT_MAP                      "map"


//typedef void  (*PFInit)( void*, const void* );
typedef void  (*PFCopy)( void* a_pDest, const void* a_pSrc, size_t a_szCount );
typedef  int  (*PFCompare)( const void* a_pLeft, const void* a_pRight );
typedef void  (*PFSort)( void* a_pBaseElem, size_t a_szElemCnt, size_t a_szElemSize, PFCompare a_pfnCompare );
typedef void* (*PFSearch)( const void *a_pKeyElem, void* a_pBaseElem, size_t a_szElemCnt, size_t a_szElemSize, PFCompare a_pfnCompare );
typedef void  (*PFDestroy)( void* pObject );

typedef struct tagSStlcType{
	size_t            szTypeSize;                         
	char              cTypeName[ TYPE_NAME_SIZE + 1 ]; 	                       
	PFCopy            pfnCopy;                       
	PFCompare         pfnCompare;  	
	PFDestroy         pfnDestroy;                     
}SStlcType, *PSStlcType;

STLCDLL_EXPORTS	void StlcCopyMemory( void* a_pDest, const void* a_pSrc, size_t a_szCount );

STLCDLL_EXPORTS	int StlcCompareMemory( const void* a_pLeft, const void* a_pRight, size_t a_szCount );
STLCDLL_EXPORTS	int StlcCompareChar( const void* a_pLeft, const void* a_pRight );
STLCDLL_EXPORTS int StlcCompareUnsignedChar( const void* a_pLeft, const void* a_pRight );
STLCDLL_EXPORTS int StlcCompareShort( const void* a_pLeft, const void* a_pRight );
STLCDLL_EXPORTS int StlcCompareUnsignedShort( const void* a_pLeft, const void* a_pRight );
STLCDLL_EXPORTS int StlcCompareInt( const void* a_pLeft, const void* a_pRight );
STLCDLL_EXPORTS int StlcCompareUnsignedInt( const void* a_pLeft, const void* a_pRight );
STLCDLL_EXPORTS int StlcCompareLong( const void* a_pLeft, const void* a_pRight );
STLCDLL_EXPORTS int StlcCompareUnsignedLong( const void* a_pLeft, const void* a_pRight );
STLCDLL_EXPORTS int StlcCompareFloat( const void* a_pLeft, const void* a_pRight );
STLCDLL_EXPORTS int StlcCompareDouble( const void* a_pLeft, const void* a_pRight );
STLCDLL_EXPORTS int StlcCompareStringA( const void* a_pLeft, const void* a_pRight );
STLCDLL_EXPORTS int StlcCompareStringW( const void* a_pLeft, const void* a_pRight );
STLCDLL_EXPORTS int StlcComparePair( const void* a_pLeft, const void* a_pRight );

STLCDLL_EXPORTS void StlcUnifyTypes( PSStlcType a_pstStlcType, size_t a_szTypeSize, const char* a_pcTypeName, PFCompare a_pfnCompare );
STLCDLL_EXPORTS bool StlcSameType( const SStlcType* a_pstTypeFirst, const SStlcType* a_pstTypeSecond );

#ifdef __cplusplus
}
#endif

#endif 